package org.ddd.orderdemo.application.event.handler;

import com.google.common.eventbus.Subscribe;
import org.ddd.orderdemo.application.event.DomainEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BusinessHandler implements Handler {

    private Logger logger = LoggerFactory.getLogger(BusinessHandler.class);

    /**
     * 订阅方法必须有且仅有一个参数
     * 必须使用@Subscribe注解
     * 方法需为public
     * @param event
     */
    @Subscribe // 处理方法
    public void handle(DomainEvent event) {

        // 复杂业务逻辑
        logger.info("event:{}", event);

    }

}
